class TypeHandler:
    @staticmethod
    def ensure_string(item):
        """
        确保输入项为字符串类型
        如果是列表，则将其连接为字符串
        """
        if isinstance(item, list):
            return ' '.join(map(str, item))
        return str(item)

    @staticmethod
    def handle_sequence_error(sequence):
        """
        处理序列中的类型错误
        """
        try:
            return [TypeHandler.ensure_string(item) for item in sequence]
        except Exception as e:
            raise ValueError(f"序列处理错误: {str(e)}")
